Background

How has COVID-19 affected mobility of people and goods across the globe?

We are interested in the pandemic’s effects on society. The dataset discusses how goods have moved and how people have travelled given all these different restrictions.

We have seen how different measures from country to country, state to state, district to district have altered the free movement of people and goods. The presumptive goal of every single measure was to lower the confirmed cases and deaths in the given region that are due to the virus. With so many different and disparate approaches, it’s difficult to see what measures correlated with what behavior. We decided to compare two regions, similar in geographic location, population size, culture, and history: Sweden and Denmark. Their mobility behavior and COVID-19 statistics are reflected in the two data sets: covid19_ecdc.covid_19_geographic_distribution_worldwide and covid19_google_mobility.mobility_report.

We chose these regions because the approach to mitigating the effects of COVID-19 in terms of mobility and the resultant economic and health implications were considerably different. While both effectively closed their borders, mobility was severely curtailed in Denmark (lockdown) whereas Sweden only issued recommendations (non-mandatory). These are contrasting responses for geographies that are physically connected and whose populations are virtually homogeneous to each other.

An important consideration for these datasets is to treat time itself as a variable. There are many ways to treat time, and in this analysis we considered time in terms of before-and-after. Moreover, incorporating time gives us causal leverage. We want to see how behavior changed after some particular event takes place. We explored how COVID-19 influenced mobility instrumentally through border closures. And specifically, we considered COVID-19 metrics (cases and deaths per million) before and after border closures - since this was a measure taken by most countries and severely restricted mobility of people and goods across the globe. We employ a before-and-after modeling technique in time series analysis called difference-in-differences, or a pretest-posttest with comparison group. For this to be a valid method, all we must assume is the equal change or parallel trends - reflected in our choice of Sweden and Denmark.

Lastly, in order to incorporate uncertainty, we performed Bayesian modeling calling Stan in R. This gives us a posterior distribution for our estimates, rather than single point estimates, and credibility intervals that allows us to make a probability statement about our estimates given the observed data.

Time series models are very sensitive to missingness so check our data for missing measurements.

# visualize NAs
vis_miss(mobility, warn_large_data =  F)

The data seems to have been collected sparsely for some variables on some days, so we will aggregate into weeks and months. The jitter from day to day is likeley to be too granular for this model anyway.


Data Exploration

After Border Closures

Recall, Denmark closed its border on March 14, 2020. Meanwhile, Sweden closes its borders to non-EU member states on March 19, 2020, and virtually all EU countries imposed travel restrictions at about the same time effectively prohibiting all travel into Sweden. The result is equivalent to a closed border. Both are closed within a week of each other, and we treat these as roughly equivalent for our analysis purposes.


Change in Mobility



Changes in Mobility Over Time by Month

grid.arrange(a, b, c, d, e, nrow = 5)



Changes in Mobility Over Time by Week

grid.arrange(f, g, h, i, j, nrow = 5)



Change in COVID Metrics


Monthly Averages of COVID-19 Statistics

grid.arrange(l, n, o, nrow = 3)


Weekly Averages of COVID-19 Statistics

grid.arrange(q, s, t, nrow = 3)


Difference in Differences

What is the effect of a mobility related policy on COVID related metrics?

A difference in differences model compares COVID related metrics before-and-after border closure for Sweden to the before-and-after border closure for Denmark. For two countries that can be considered quite easily the same country, we would expect the closure of borders to have comparable effects on COVID metrics.

In Conditional Mean Terms

Observing only differences in means daily confirmed cases per million between Sweden and Denmark, there is an increase of an additional 32 cases for Sweden as compared to Denmark.

Country Change in Daily Confirmed Cases per Million
Sweden Increase of 4 to 47 daily confirmed cases per million
Denmark Increase of 6 to 17 daily confirmed cases per million

Observing only differences in means daily deaths per million between Sweden and Denmark, there is an increase of an additional 2 cases for Sweden as compared to Denmark.

Country Change in Daily Deaths per Million
Sweden Increase from 0 to 3 daily deaths per million
Denmark Increase from 0 to 1 daily deaths per million

In Regression Terms

Daily Cases per Million


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0.00052 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 5.2 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.068331 seconds (Warm-up)
Chain 1:                4.83693 seconds (Sampling)
Chain 1:                4.90526 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 2.2e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.22 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.057167 seconds (Warm-up)
Chain 2:                4.80694 seconds (Sampling)
Chain 2:                4.86411 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 2e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.076665 seconds (Warm-up)
Chain 3:                4.79257 seconds (Sampling)
Chain 3:                4.86924 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 1.5e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.15 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.064612 seconds (Warm-up)
Chain 4:                4.79496 seconds (Sampling)
Chain 4:                4.85957 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd    10%   50%   90%
(Intercept)           -12.4    0.3 -12.8 -12.4 -12.0
factor(closed)1        33.3    0.3  33.0  33.3  33.7
factor(country)Sweden  24.7    0.2  24.4  24.7  24.9
sigma                  27.3    0.1  27.2  27.3  27.4

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 33.4    0.2 33.2  33.4  33.6 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  4526 
factor(closed)1       0.0  1.0  4757 
factor(country)Sweden 0.0  1.0  4746 
sigma                 0.0  1.0  4962 
mean_PPD              0.0  1.0  3137 
log-posterior         0.0  1.0  1854 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 2.1e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.21 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.124624 seconds (Warm-up)
Chain 1:                2.36545 seconds (Sampling)
Chain 1:                2.49007 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 1.6e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.16 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.145609 seconds (Warm-up)
Chain 2:                2.34511 seconds (Sampling)
Chain 2:                2.49072 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 2.4e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.24 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.133507 seconds (Warm-up)
Chain 3:                2.35057 seconds (Sampling)
Chain 3:                2.48407 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 1.8e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.116909 seconds (Warm-up)
Chain 4:                2.34861 seconds (Sampling)
Chain 4:                2.46552 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country) + 
       retail_rec * grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd    10%   50%   90%
(Intercept)              -10.1    0.4 -10.5 -10.1  -9.6
factor(closed)1           31.4    0.4  30.9  31.4  31.9
factor(country)Sweden     23.5    0.3  23.1  23.5  23.9
retail_rec                -0.3    0.0  -0.3  -0.3  -0.3
grocery_pharm              0.3    0.0   0.3   0.3   0.3
retail_rec:grocery_pharm   0.0    0.0   0.0   0.0   0.0
sigma                     25.1    0.1  25.0  25.1  25.3

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 31.0    0.2 30.7  31.0  31.2 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  3664 
factor(closed)1          0.0  1.0  3757 
factor(country)Sweden    0.0  1.0  3836 
retail_rec               0.0  1.0  3459 
grocery_pharm            0.0  1.0  3365 
retail_rec:grocery_pharm 0.0  1.0  6516 
sigma                    0.0  1.0  3711 
mean_PPD                 0.0  1.0  3360 
log-posterior            0.0  1.0  1576 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
                                    5%          95%
(Intercept)              -10.674710361 -9.449373079
factor(closed)1           30.812341203 32.043026090
factor(country)Sweden     23.040515236 24.007609006
retail_rec                -0.279275946 -0.253931065
grocery_pharm              0.280262570  0.323680441
retail_rec:grocery_pharm   0.001929069  0.002558578
sigma                     24.958531471 25.288932395
summary(reg1)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd    10%   50%   90%
(Intercept)           -12.4    0.3 -12.8 -12.4 -12.0
factor(closed)1        33.3    0.3  33.0  33.3  33.7
factor(country)Sweden  24.7    0.2  24.4  24.7  24.9
sigma                  27.3    0.1  27.2  27.3  27.4

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 33.4    0.2 33.2  33.4  33.6 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  4526 
factor(closed)1       0.0  1.0  4757 
factor(country)Sweden 0.0  1.0  4746 
sigma                 0.0  1.0  4962 
mean_PPD              0.0  1.0  3137 
log-posterior         0.0  1.0  1854 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
summary(reg2)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_confirmed_cases_per_mil ~ factor(closed) + factor(country) + 
       retail_rec * grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd    10%   50%   90%
(Intercept)              -10.1    0.4 -10.5 -10.1  -9.6
factor(closed)1           31.4    0.4  30.9  31.4  31.9
factor(country)Sweden     23.5    0.3  23.1  23.5  23.9
retail_rec                -0.3    0.0  -0.3  -0.3  -0.3
grocery_pharm              0.3    0.0   0.3   0.3   0.3
retail_rec:grocery_pharm   0.0    0.0   0.0   0.0   0.0
sigma                     25.1    0.1  25.0  25.1  25.3

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 31.0    0.2 30.7  31.0  31.2 

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  3664 
factor(closed)1          0.0  1.0  3757 
factor(country)Sweden    0.0  1.0  3836 
retail_rec               0.0  1.0  3459 
grocery_pharm            0.0  1.0  3365 
retail_rec:grocery_pharm 0.0  1.0  6516 
sigma                    0.0  1.0  3711 
mean_PPD                 0.0  1.0  3360 
log-posterior            0.0  1.0  1576 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
posterior_interval(reg2, prog = .9, type = 'central', pars = NULL, regex_pars = NULL)
                                    5%          95%
(Intercept)              -10.674710361 -9.449373079
factor(closed)1           30.812341203 32.043026090
factor(country)Sweden     23.040515236 24.007609006
retail_rec                -0.279275946 -0.253931065
grocery_pharm              0.280262570  0.323680441
retail_rec:grocery_pharm   0.001929069  0.002558578
sigma                     24.958531471 25.288932395

There is an increase of about 32*** daily confirmed cases per million after border closure. In Sweden alone, net of other measures, there was an increase of roughly 23 daily confirmed cases per million. Net of country and other measures, restriction of mobility for retail/recreation and grocery/pharmacy establishments (interaction term) does not appear to decrease the daily confirmed cases per million. Interestingly, restriction on mobility for retail/recreation appears to decrease daily confirmed cases net of other measures, but restricting grocery/pharmacy mobility does not. Both of these measures are close to zero, however. These statistics are all significant at the 99.9% confidence level. The overall model explains only 33% of the variance in the observed confirmed daily cases per million.

Daily Deaths per Million


SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 1.8e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.051689 seconds (Warm-up)
Chain 1:                4.83162 seconds (Sampling)
Chain 1:                4.88331 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 2e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.053309 seconds (Warm-up)
Chain 2:                4.8066 seconds (Sampling)
Chain 2:                4.85991 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 1.8e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.050814 seconds (Warm-up)
Chain 3:                4.79772 seconds (Sampling)
Chain 3:                4.84853 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 1.7e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.17 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.053057 seconds (Warm-up)
Chain 4:                4.79813 seconds (Sampling)
Chain 4:                4.85119 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd   10%   50%   90%
(Intercept)           -1.4    0.0 -1.5  -1.4  -1.4 
factor(closed)1        2.3    0.0  2.3   2.3   2.3 
factor(country)Sweden  2.1    0.0  2.1   2.1   2.1 
sigma                  2.4    0.0  2.4   2.4   2.4 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 2.0    0.0  2.0   2.0   2.0  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  4786 
factor(closed)1       0.0  1.0  5225 
factor(country)Sweden 0.0  1.0  4968 
sigma                 0.0  1.0  5296 
mean_PPD              0.0  1.0  3206 
log-posterior         0.0  1.0  2038 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 2e-05 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0.2 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.092137 seconds (Warm-up)
Chain 1:                2.40208 seconds (Sampling)
Chain 1:                2.49421 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 1.8e-05 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0.18 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.099677 seconds (Warm-up)
Chain 2:                2.41329 seconds (Sampling)
Chain 2:                2.51297 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 1.7e-05 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0.17 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.093411 seconds (Warm-up)
Chain 3:                2.39411 seconds (Sampling)
Chain 3:                2.48752 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 1.7e-05 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0.17 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.117388 seconds (Warm-up)
Chain 4:                2.64484 seconds (Sampling)
Chain 4:                2.76223 seconds (Total)
Chain 4: 

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country) + retail_rec * 
       grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd   10%   50%   90%
(Intercept)              -1.3    0.0 -1.3  -1.3  -1.3 
factor(closed)1           2.2    0.0  2.2   2.2   2.2 
factor(country)Sweden     2.1    0.0  2.1   2.1   2.1 
retail_rec                0.0    0.0  0.0   0.0   0.0 
grocery_pharm             0.0    0.0  0.0   0.0   0.0 
retail_rec:grocery_pharm  0.0    0.0  0.0   0.0   0.0 
sigma                     2.2    0.0  2.2   2.2   2.2 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 1.9    0.0  1.8   1.9   1.9  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  4010 
factor(closed)1          0.0  1.0  3759 
factor(country)Sweden    0.0  1.0  4092 
retail_rec               0.0  1.0  4416 
grocery_pharm            0.0  1.0  3935 
retail_rec:grocery_pharm 0.0  1.0  6442 
sigma                    0.0  1.0  4013 
mean_PPD                 0.0  1.0  3501 
log-posterior            0.0  1.0  1943 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
                                    5%           95%
(Intercept)              -1.3551677039 -1.2488135402
factor(closed)1           2.1432266349  2.2507212883
factor(country)Sweden     2.0577735008  2.1389014927
retail_rec               -0.0333756615 -0.0311675563
grocery_pharm             0.0066469295  0.0105071363
retail_rec:grocery_pharm  0.0001024917  0.0001559549
sigma                     2.1826679202  2.2116067412
summary(reg3)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country)
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 68976
 predictors:   3

Estimates:
                        mean   sd   10%   50%   90%
(Intercept)           -1.4    0.0 -1.5  -1.4  -1.4 
factor(closed)1        2.3    0.0  2.3   2.3   2.3 
factor(country)Sweden  2.1    0.0  2.1   2.1   2.1 
sigma                  2.4    0.0  2.4   2.4   2.4 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 2.0    0.0  2.0   2.0   2.0  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                      mcse Rhat n_eff
(Intercept)           0.0  1.0  4786 
factor(closed)1       0.0  1.0  5225 
factor(country)Sweden 0.0  1.0  4968 
sigma                 0.0  1.0  5296 
mean_PPD              0.0  1.0  3206 
log-posterior         0.0  1.0  2038 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
summary(reg4)

Model Info:
 function:     stan_glm
 family:       gaussian [identity]
 formula:      daily_deaths_per_mil ~ factor(closed) + factor(country) + retail_rec * 
       grocery_pharm
 algorithm:    sampling
 sample:       4000 (posterior sample size)
 priors:       see help('prior_summary')
 observations: 32567
 predictors:   6

Estimates:
                           mean   sd   10%   50%   90%
(Intercept)              -1.3    0.0 -1.3  -1.3  -1.3 
factor(closed)1           2.2    0.0  2.2   2.2   2.2 
factor(country)Sweden     2.1    0.0  2.1   2.1   2.1 
retail_rec                0.0    0.0  0.0   0.0   0.0 
grocery_pharm             0.0    0.0  0.0   0.0   0.0 
retail_rec:grocery_pharm  0.0    0.0  0.0   0.0   0.0 
sigma                     2.2    0.0  2.2   2.2   2.2 

Fit Diagnostics:
           mean   sd   10%   50%   90%
mean_PPD 1.9    0.0  1.8   1.9   1.9  

The mean_ppd is the sample average posterior predictive distribution of the outcome variable (for details see help('summary.stanreg')).

MCMC diagnostics
                         mcse Rhat n_eff
(Intercept)              0.0  1.0  4010 
factor(closed)1          0.0  1.0  3759 
factor(country)Sweden    0.0  1.0  4092 
retail_rec               0.0  1.0  4416 
grocery_pharm            0.0  1.0  3935 
retail_rec:grocery_pharm 0.0  1.0  6442 
sigma                    0.0  1.0  4013 
mean_PPD                 0.0  1.0  3501 
log-posterior            0.0  1.0  1943 

For each parameter, mcse is Monte Carlo standard error, n_eff is a crude measure of effective sample size, and Rhat is the potential scale reduction factor on split chains (at convergence Rhat=1).
posterior_interval(reg4, prog = .9, type = 'central', pars = NULL, regex_pars = NULL)
                                    5%           95%
(Intercept)              -1.3551677039 -1.2488135402
factor(closed)1           2.1432266349  2.2507212883
factor(country)Sweden     2.0577735008  2.1389014927
retail_rec               -0.0333756615 -0.0311675563
grocery_pharm             0.0066469295  0.0105071363
retail_rec:grocery_pharm  0.0001024917  0.0001559549
sigma                     2.1826679202  2.2116067412

There is an increase of about 2*** daily deaths per million after border closure. In Sweden alone, net of other measures, there was an increase of roughly 2 daily deaths per million. Net of country and other measures, restriction of mobility for retail/recreation and grocery/pharmacy establishments (interaction term) does not appear to decrease the daily deaths per million. These statistics are all significant at the 99.9$% confidence level. The overall model explains only 33% of the variance in the observed daily deaths per million.

Discussion and Next Steps

Our results confirm that irrespective of mobility curtailment and measures undertaken, from border closures to restaurant shutdowns, both countries’ health metrics eventually converged to comparable levels with marginal differences through time, while the difference was predominantly observed in diminished mobility and increased economic disruption. Next up, it would be prudent to examine data pertaining to the characteristics of the deceased and infected. Should additional data confirm what the reportage suggests, i.e. that the majority of the deaths occurred concomitant with underlying health issues, especially vis-a-vis higher age brackets, the rationale for mobility restrictions would face serious credibility problems.